package com.ixion.blog.bean;

import java.util.Date;

import org.nutz.dao.entity.annotation.Column;
import org.nutz.dao.entity.annotation.Id;
import org.nutz.dao.entity.annotation.Name;
import org.nutz.dao.entity.annotation.Table;

@Table("blog_user")
public class User {
	/**
	 * 性别常量：男
	 */
	public static final int SEX_MAN = 1;
	/**
	 * 性别常量：女
	 */
	public static final int SEX_WOMEN = 2;
	/**
	 * 编号 数据库自动生成
	 */
	@Id
	@Column("u_id")
	private int id;
	/**
	 * 登录名,业务唯一字段
	 */
	@Name
	@Column("u_name")
	private String name;
	/**
	 * 用户年龄
	 */
	@Column("u_age")
	private int age;
	/**
	 * 用户密码 采用md5加密 Lang.md5()
	 */
	@Column("u_pwd")
	private String password;
	/**
	 * 真实姓名
	 */
	@Column("u_real_name")
	private String realName;
	/**
	 * 性别
	 */
	@Column("u_sex")
	private int sex;
	/**
	 * 生日
	 */
	@Column("u_brith")
	private Date brithDay;
	/**
	 * 个人主页
	 */
	@Column("u_home_page")
	private String homePage;
	/**
	 * 电子邮箱
	 */
	@Column("u_email")
	private String email;

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		User other = (User) obj;
		if (id != other.id)
			return false;
		return true;
	}

	/**
	 * @return the age
	 */
	public int getAge() {
		return age;
	}

	/**
	 * @return the brithDay
	 */
	public Date getBrithDay() {
		return brithDay;
	}

	/**
	 * @return the email
	 */
	public String getEmail() {
		return email;
	}

	/**
	 * @return the homePage
	 */
	public String getHomePage() {
		return homePage;
	}

	/**
	 * @return the id
	 */
	public int getId() {
		return id;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @return the password
	 */
	public String getPassword() {
		return password;
	}

	/**
	 * @return the realName
	 */
	public String getRealName() {
		return realName;
	}

	/**
	 * @return the sex
	 */
	public int getSex() {
		return sex;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + id;
		return result;
	}

	/**
	 * @param age
	 *            the age to set
	 */
	public void setAge(int age) {
		this.age = age;
	}

	/**
	 * @param brithDay
	 *            the brithDay to set
	 */
	public void setBrithDay(Date brithDay) {
		this.brithDay = brithDay;
	}

	/**
	 * @param email
	 *            the email to set
	 */
	public void setEmail(String email) {
		this.email = email;
	}

	/**
	 * @param homePage
	 *            the homePage to set
	 */
	public void setHomePage(String homePage) {
		this.homePage = homePage;
	}

	/**
	 * @param id
	 *            the id to set
	 */
	public void setId(int id) {
		this.id = id;
	}

	/**
	 * @param name
	 *            the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @param password
	 *            the password to set
	 */
	public void setPassword(String password) {
		this.password = password;
	}

	/**
	 * @param realName
	 *            the realName to set
	 */
	public void setRealName(String realName) {
		this.realName = realName;
	}

	/**
	 * @param sex
	 *            the sex to set
	 */
	public void setSex(int sex) {
		this.sex = sex;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "User [id=" + id + ", name=" + name + ", age=" + age + ", password=" + password + ", realName=" + realName + ", sex=" + sex + ", brithDay=" + brithDay + ", homePage=" + homePage
				+ ", email=" + email + "]";
	}

}
